<%@ page import="entity.Emp" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: User
  Date: 2024/9/2
  Time: 16:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>员工列表</title>
</head>
<body>
<h1>员工列表</h1>
<a href="<%=request.getContextPath()%>/ems/addEmp.jsp">添加员工</a>
<table>
    <thead>
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>工资</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>

    <%
        List<Emp> emps= (List<Emp>) request.getAttribute("emps");
        for(Emp emp:emps){
    %>
    <tr>
        <td><%=emp.getId()%></td>
        <td><%=emp.getName()%></td>
        <td><%=emp.getSalary()%></td>
        <td>
            <a href="<%=request.getContextPath()%>/findById.ems?id=<%=emp.getId()%>">修改</a>
            <a href="<%=request.getContextPath()%>/deleteById.ems?id=<%=emp.getId()%>">删除</a>

        </td>
    </tr>

    <%
        }
    %>
    </tbody>
</table>
</body>
</html>